var http = require('http');
var go = require('iconv-lite');
function download(url, callback) {
    http.get(url, function(res) {
        var data = "";
        // res.setEncoding('gb2312');
        res.on('data', function(chunk) {
            data += go.decode(chunk,'utf-8')
        });
        res.on('end', function() {
            callback(data)
        });
    }).on('error', function() {
        callback(null)
    })
}

exports.download = download;